package com.xhrd.framework.dao;

import java.io.Serializable;
import java.util.List;

import com.xhrd.framework.vo.Page;
import com.xhrd.framework.vo.SearchCondition;

@SuppressWarnings(value = { "unchecked", "rawtypes" })
public interface BaseDAO<T, ID extends Serializable> {

    public T findById(ID id);

    public List<T> findByIds(ID... ids);

    public List<T> findAll();

    public T save(T entity);

    public boolean[] save(T... entities);

    public T update(T entity);

    public boolean remove(T entity);

    public void remove(T... entities);

    public boolean removeById(ID id);

    public boolean removeByIds(ID... ids);

    /**
     * 查询单个对象
     *
     * @param searchCondition
     * @return
     */
    public T searchUnique(SearchCondition searchCondition);

    /**
     * 根据条件查询
     *
     * @param searchCondition
     * @return
     */
    public List<T> search(T entity);

    /**
     * 根据条件查询对象SearchCondition查询
     * @param searchCondition
     * @return
     */
    public List<T> search(SearchCondition searchCondition);

    /**
     * 分页查询
     *
     * @param statementName
     * @param searchCondition
     * @return
     */
    /**
     * 分页查询
     *
     * @param statementName
     * @param searchCondition
     * @return
     */
    public Page pageQuery(String statementName, SearchCondition searchCondition);

}
